package com.ojoin.trade.t0loan_core.web.service;

import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestParam;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.t0loan_core.web.domain.T0LoanCheckAccountInfoVO;
import com.ojoin.trade.t0loan_core.web.domain.T0LoanTransanctionLogInfoVO;
import com.ojoin.trade.t0loan_core.web.domain.TbT0LoanTransanctionLog;

/**
 * T+0贷款操作日志服务接口
 * 
 * @author guoting
 * 
 */
public interface T0LoanTransanctionLogBaseService extends
		BaseService<TbT0LoanTransanctionLog> {

	/**
	 * 新增T+0贷款业务账户变更操作日志记录(T0000011)
	 * 
	 * 说明： 向tb_t0_loan_transanction_log表插入一条记录，记录业务日志
	 * 
	 * @throws BusinessException
	 */
	public int insertT0LoanTransanctionLog(HashMap<String, Object> parammap)
			throws BusinessException;

	/**
	 * 查询T0贷款对账信息列表(T0000022)
	 * 
	 * 说明：
	 * 关联查询tb_t0_loan_transanction_log、tb_t0_pos_transcation_of_loan_transanction、
	 * tb_pos_transcation_log.clearingamount、tb_t0_status_of_pos_transcation
	 * 四张表查询商户对账信息列表，记录业务日志
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public List<T0LoanCheckAccountInfoVO> queryAllT0LoanCheckAccountInfoList(Pageable page) 
			throws BusinessException;
	
	/**
	 * 查询Tx贷款对账信息列表
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public List<T0LoanCheckAccountInfoVO> queryAllTxLoanCheckAccountInfoList(String operatetype, String mhtno, String startdate, String enddate, String ismhtnosplit, Pageable page) 
			throws BusinessException;
	
	public List<T0LoanCheckAccountInfoVO> queryTotalTxLoanCheckAccountInfo(String operatetype, String mhtno, String startdate, String enddate, Pageable page) 
			throws BusinessException;
	
	
	/**
	 * 查询指定日期指定商户的贷款业务债权用户id(T0000021)
	 * @param debtor_mhtno
	 * @param creditdate
	 * 
	 * 说明： 查询tb_t0_loan_transanction_log表中指定日期指定债务人对应的债权用户信息，记录业务日志
	 * @return
	 * @throws BusinessException
	 */
	public TbT0LoanTransanctionLog queryCreditorInfoFromDebtorMhtNoAndDate(String debtor_mhtno, String creditdate)  
			throws BusinessException;
	
	/**
	 * 查询指定商户的实时T+0贷款负债信息列表(T0000028)
	 * @param mhtno
	 * @return
	 * @throws BusinessException
	 */
	public List<T0LoanCheckAccountInfoVO> queryT0LoanBalanceInfoListByDebtorMhtno(String mhtno,Pageable page) 
			throws BusinessException;
	
	/**
	 * 查询指定商户的实时Tx贷款负债信息
	 * @param mhtno
	 * @return
	 * @throws BusinessException
	 */
	public T0LoanCheckAccountInfoVO queryTxLoanBalanceInfoByDebtorMhtno(String mhtno) 
			throws BusinessException;
	
	/**
	 * 查询指定债务人的贷款历史记录(T0000033)
	 * @param param
	 * @return
	 * @throws BusinessException
	 */
	public List<T0LoanTransanctionLogInfoVO> queryT0LoanTransanctionLogInfoListByDebtorMhtNo(Map param,Pageable page)
			throws BusinessException;
	
	/**
	 * 查询指定债务人的Tx贷款历史记录
	 * @param param
	 * @return
	 * @throws BusinessException
	 */
	public List<T0LoanTransanctionLogInfoVO> queryTxLoanTransanctionLogInfoListByDebtorMhtNo(String debtor_mhtno, String operation_type, Pageable page) throws BusinessException;
		
		
	/**
	 * 查询所有已审核未放款的贷款日志记录
	 * @param param
	 * @return
	 * @throws BusinessException
	 */
	public List<T0LoanTransanctionLogInfoVO> queryTxLoanTransanctionLogNotCreditInfoList(Pageable page, String operatetype)
			throws BusinessException;
	
	/**
	 * 更新放款日志状态
	 * @param id
	 * @param creditstatus
	 * @param creditAccountBalance
	 * @return
	 * @throws BusinessException
	 */
	public int updateT0LoanTransanctionLogCreditStatusByID(int id, int creditstatus, String creditAccountBalance) throws BusinessException;

	/**
	 * 更新放款日志状态
	 * @param paramsmap
	 * @return
	 * @throws BusinessException
	 */
	public int updateT0LoanTransanctionLogVO(Map<String, Object> paramsmap) throws BusinessException;
	
	public void lockId(int id)throws BusinessException;

    public void lockTable()throws BusinessException;
    
    /**
     * 根据业务日期生成结算单
     * @param busidate
     * @param outputStream
     * @return 需充值的垫款总额
     * @throws BusinessException
     */
    public String exportTxSettlementExl(String operatetype, String busidate, OutputStream outputStream) throws BusinessException;
    
    /**
     * 查询Tx贷款结算单列表
     * @param busidate
     * @return
     * @throws BusinessException
     */
    public List<T0LoanTransanctionLogInfoVO> queryTxSettlementListByBusidate(String operatetype, String busidate) throws BusinessException;
    
    /**
     * 查询Tx贷款结算单合计信息
     * @param busidate
     * @return
     * @throws BusinessException
     */
    public T0LoanTransanctionLogInfoVO queryTxSettlementTotalByBusidate(String operatetype, String busidate) throws BusinessException;
    
    /**
     * 查询指定商户未还清的贷款记录集合
     * @param joinuserid
     * @return
     * @throws BusinessException
     */
    public List<TbT0LoanTransanctionLog> queryUnRefundT0LoanTransanctionLogList(int joinuserid) throws BusinessException;
    
    /**
     * 还款后提现
     * @param loanlogid
     * @param paypwd
     * @param pagets
     * @return
     * @throws BusinessException
     */
    public void drawByTransLogRefund(Integer loanlogid, String paypwd, String pagets) throws BusinessException;
    
    public void drawByTransLogRefundRedo(Integer loanlogid, String pagets, String orderid) throws BusinessException;
    
    /**
     * 查询未提现的贷款记录集合
     * @return
     * @throws BusinessException
     */
    public List<TbT0LoanTransanctionLog> queryUnDrawT0LoanTransanctionLogList(String operatetype, Pageable page) throws BusinessException;
    
	/**
     * 导出垫款对账文件
     * @throws BusinessException
     */
    public void exportTxCheckAcccountFile(String startdate, String enddate, Integer joinuserid, OutputStream outputStream) throws BusinessException;

}
